package com.canomo.tag;

import com.alibaba.druid.util.StringUtils;
import com.baomidou.mybatisplus.toolkit.CollectionUtils;
import freemarker.template.TemplateMethodModelEx;
import freemarker.template.TemplateModelException;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 自定义实现Freemarker标签
 * Created by xiaoj on 2018/7/18.
 */
@Component("customerTag")
public class CustomerTag implements TemplateMethodModelEx {
    @Override
    public Object exec(List arguments) throws TemplateModelException {
        if (CollectionUtils.isNotEmpty(arguments)) {
            String obj = String.valueOf(arguments.get(0));
            if (StringUtils.equals(obj,"hello")) {
                return true;
            } else {
                return false;
            }

        }
        return false;
    }
}
